package cn.wolfcode.service.impl;

import cn.wolfcode.domain.ConsumptionItem;
import cn.wolfcode.domain.ConsumptionItemKey;
import cn.wolfcode.mapper.ConsumptionItemMapper;
import cn.wolfcode.service.IConsumptionItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsumptionItemService implements IConsumptionItemService {

    @Autowired
    private ConsumptionItemMapper consumptionItemMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return consumptionItemMapper.deleteByPrimaryKey(new ConsumptionItemKey(id));
    }

    @Override
    public int insert(ConsumptionItem record) {
        return consumptionItemMapper.insert(record);
    }

    @Override
    public ConsumptionItem selectByPrimaryKey(Long id) {
        return consumptionItemMapper.selectByPrimaryKey(new ConsumptionItemKey(id));
    }

    @Override
    public List<ConsumptionItem> selectAll() {
        return consumptionItemMapper.selectAll();
    }

    @Override
    public int updateByPrimaryKey(ConsumptionItem record) {
        return consumptionItemMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<ConsumptionItem> selectByCno(String cno) {
        return consumptionItemMapper.selectByCno(cno);
    }

    @Override
    public void deleteByCno(String cno) {
        consumptionItemMapper.deleteByCno(cno);
    }
}
